package com.shiguiwu.springmybatis.spring.aop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

/**
 * @description: hah
 * @author: stone
 * @date: Created by 2021/6/10 10:32
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.aop.aspect
 */
@Aspect
public class MyAspect {

    @Pointcut("execution(public * com.shiguiwu.springmybatis.spring.aop.aspect.AspectService.*(..))")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void before(JoinPoint joinPoint) {
        System.out.println("前置通知：" + joinPoint);

    }


    @AfterThrowing(value = "pointCut()", throwing = "e")
    public void afterThrowing(JoinPoint joinPoint, Exception e) {
        System.out.println(joinPoint + ",通知异常：e==>" + e.getMessage());
    }
}
